package com.nbicc.attachments.service;

import com.nbicc.attachments.po.Attachment;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: lilingyan
 */
public interface IAttachmentService {

    /**
     * 上传附件
     * @param request
     * @param uploadFile
     * @return
     * @throws Exception
     */
    Attachment uploadFile(HttpServletRequest request, MultipartFile uploadFile) throws Exception;

    /**
     * 下载附件
     * @param request
     * @param response
     * @param id
     * @throws Exception
     */
    void downloadFile(HttpServletRequest request, HttpServletResponse response, long id) throws Exception;

    /**
     * 删除附件
     * @param id
     * @throws IOException
     */
    void deleteFile(long id) throws IOException;
}
